package summative;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;

public class Properties extends JPanel
{
	VectorFocusList fList;
	int x = 20;
	int y = 20;
	
	public Properties(VectorFocusList fList)
	{
		super();
		setBackground(Color.WHITE);
		setPreferredSize(new Dimension(300, 1000));
	
		this.fList = fList;
		fList.setPropPanel(this);
		setVisible(true);
	}
	
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);


		for(Vector vector:fList.getArray())
		{
			g.clearRect(0, 0, 300, 1000);
			g.drawString(vector.getUnitVec(), x, y);
			//Draws the angle
			g.drawString("Angle of Vector" + (vector.getAngle()), x, x+20);
			//Gets the magnitude
			g.drawString("Magnitude of Vector: " + (vector.getLength()), x, x+40);
			//Gets the slope
			g.drawString("Slope of the Vector: " + (vector.getSlope()), x, x+60);
			//Gets x and y
			g.drawString("Unit Vector Coordinates: " + (vector.getDrawCoordXF()) + ", " + (vector.getDrawCoordYF()), x, y+80);
		}
	}
	
	public void updateView()
	{
		repaint();
	}
}
